import { getData } from '@/utils/request'

export interface IDistrictRankItem {
  regionCode: string
  regionName: string
  average: number
}

export const getDistrictRank = (params: { entId: string }) => {
  // return Promise.resolve({ data: districtRankMockData })

  return getData<IDistrictRankItem[]>('/code/api/dp3/xzqytx', params)
}

type GetSafeIndexOrderParams = {
  entId: string
  type: number
  safeIndexType: 'up' | 'down' | 'error'
  topNum: number
}

export interface SafeIndexOrderRecord {
  name: string
  beforecope: string
  aftercope: string
  huanBiScope: string
  number: string
}

export const getSafeIndexOrder = async (params: GetSafeIndexOrderParams) => {
  const { data } = await getData<SafeIndexOrderRecord[]>(
    '/code/api/dp3/safeIndexOrder',
    params
  )
  return data
}
